//
//  DeviceInfo.m
//  KEREN
//
//  Created by MW on 2023/3/14.
//

#import "DeviceInfo.h"
@implementation DeviceInfo
+ (instancetype)initWithDictionary:(NSDictionary *)jsonDic{
    DeviceInfo *model = [[super alloc] init];
    [model setValuesForKeysWithDictionary:jsonDic];
    if(model.photo){
        if(![model.photo hasPrefix:@"http"]){
            model.photo = [NSString stringWithFormat:@"%@%@",BaseimageUrl,model.photo];
        }
        model.photo = [model.photo stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

    }
    if(model.image){
        if(![model.image hasPrefix:@"http"]){
            model.image = [NSString stringWithFormat:@"%@%@",BaseimageUrl,model.image];
        }
        model.image = [model.image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    }
    return model;
}

-(id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if([key isEqualToString:@"id"]){
        self.Id  = [value intValue];
    }
    if([key isEqualToString:@"ID"]){
        self.Id  = [value intValue];
    }

}


-(BOOL)is4GDevice{
    if(self.socket_type == 1){
        return YES;
    }
    return NO;
}

@end
